/*
 * Serial.h
 *
 *  Created on: 2011-12-20
 *      Author: kaishui
 */

#ifndef SERIAL_H_
#define SERIAL_H_

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h> /*PPSIX 终端控制定义*/
#include <sys/file.h>


class Serial
{
public:
	bool Open(char* ser);
    void Close();
    bool SetParity(int speed,int parity,int databits,int stopbits);
    int Read(char* buf,int len,double timeout);
    int Write(char* buf,int len);
private:
	int m_fd;
};
#endif /* SERIAL_H_ */
